<?php
/**
 */
class EventsSharedTable extends Doctrine_Table
{
	public function getEventsByUserId($user_id)
	{
		$query=new Doctrine_Query();
		    $query->select('e.*')
		       ->from('EventsShared e')
			   ->where("UserId='".$user_id."'");
			    //echo $query->getSqlQuery();
			   	$result = $query->execute(array(),Doctrine::HYDRATE_ARRAY);
				//echo '<pre>';print_r($result);exit;
				return $result;
	}
	public function addEvent($user_id,$event_name)
	{
		
				
		$EventsShared = new EventsShared();
		$EventsShared ->text = $event_name;
		$EventsShared ->userId = $user_id;
		$EventsShared ->event_type = 0;
		$EventsShared ->start_date = date('Y-m-d H:i:s');
		
		
        //echo '<pre>';print_r($Expressions);exit;
		$EventsShared ->save();
		return $EventsShared->event_id;
	}
}